﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
using DevComponents.DotNetBar;

namespace Einstein.Platform
{

    public class MyMessageBox
    {
        public enum Category
        {
            /// <summary>
            /// 信息提示
            /// </summary>
            Info,
            /// <summary>
            /// 警告提示
            /// </summary>
            Warning
        }

        /// <summary>
        /// 显示信息，如保存的验证
        /// 此消息体会显示在窗体的下方正中
        /// </summary>
        public static void ShowMessage(Form form, string message)
        {
            ToastNotification.Show(form,
                message,
                null,
                3000,
                eToastGlowColor.Blue,
                eToastPosition.BottomCenter);
        }

        public static void ShowLoadAlert(Form form, string title, string context)
        {
            AlertCustom m_AlertOnLoad = new AlertCustom();
            m_AlertOnLoad.Title = title;
            m_AlertOnLoad.Context = context;
            Rectangle r = Screen.GetWorkingArea(form);
            m_AlertOnLoad.Location = new Point(r.Right - m_AlertOnLoad.Width, r.Bottom - m_AlertOnLoad.Height);
            m_AlertOnLoad.AutoClose = true;
            m_AlertOnLoad.AutoCloseTimeOut = 4;
            m_AlertOnLoad.AlertAnimation = eAlertAnimation.BottomToTop;
            m_AlertOnLoad.AlertAnimationDuration = 300;
            m_AlertOnLoad.Show(false);
        }

        /// <summary>
        /// 显示信息，此信息显示在主屏幕的右下角
        /// </summary>
        public static void ShowLoadAlert(Form form, Category category, string context)
        {
            string title = category == Category.Info ? "信息提示" : "警告提示";
            ShowLoadAlert(form, title, context);
        }

        /// <summary>
        /// 弹出对话框
        /// </summary>
        public static eTaskDialogResult ShowDialog(string title, string header, string context)
        {
            TaskDialogInfo info = new TaskDialogInfo(title, eTaskDialogIcon.BlueFlag,
                                            header, context, eTaskDialogButton.Ok | eTaskDialogButton.Cancel,
                                            eTaskDialogBackgroundColor.Default);
            return TaskDialog.Show(info);
        }
        /// <summary>
        /// 删除确认对话框
        /// </summary>
        /// <returns></returns>
        public static eTaskDialogResult ShowDeleteDialog()
        {
            TaskDialogInfo info = new TaskDialogInfo("删除", eTaskDialogIcon.BlueFlag,
                                            "删除后将不可恢复，确定要继续吗？", string.Empty, eTaskDialogButton.Ok | eTaskDialogButton.Cancel,
                                            eTaskDialogBackgroundColor.Default);
            return TaskDialog.Show(info);
        }

    }
}
